package com.phkj.qdh.ui.adapter.usercenter

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.phkj.qdh.R
import com.phkj.qdh.bean.MyFailoverListBean

class MyFailoverListAdapter : BaseQuickAdapter<MyFailoverListBean, QuickViewHolder>() {
    override fun onBindViewHolder(
        holder: QuickViewHolder, position: Int, item: MyFailoverListBean?
    ) {
        holder.setText(R.id.tv_type_name, item?.faultTolerantTypeName)
        holder.setText(R.id.tv_problem_name, item?.eventTypeName)
        holder.setText(R.id.tv_ban_fa_name, item?.score.toString())
        holder.setText(R.id.tv_date, item?.createdTime)
        when (item!!.status) {
            1 -> {
                holder.setText(R.id.tv_state, "待处理")
            }

            2 -> {
                holder.setText(R.id.tv_state, "已处理")
            }

            else -> {
                holder.setText(R.id.tv_state, "草稿")
            }
        }
    }

    override fun onCreateViewHolder(
        context: Context, parent: ViewGroup, viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_my_failover_list, parent)
    }
}